<!DOCTYPE html>
<html>
<head>
    <title>$app.topic 客户信息</title>
    #parse("/inc/meta.htm")
</head>
<body id="inner_page_start">
#parse("/inc/header.htm")
<div id="wrapper">
    #parse("/inc/menu.htm")
    <div id="content-wrapper">
        <div class="container-fluid">
            <!-- 面包屑-->
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    客户管理
                </li>
                <li class="breadcrumb-item active">客户信息</li>
            </ol>
        </div>
        <!-- /.container-fluid -->
        <div class="container-fluid">

            <form method="post" action="/orderpool/dataUpdate" id="form-pool-up">
                <input type="hidden" value="$!respData.id" name="id" />
                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputName" class="col-sm-2 col-form-label">姓名</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputName" placeholder="姓名" required="required"
                               value="$!respData.name" name="name" />
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputTelphone" class="col-sm-2 col-form-label">手机号码</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputTelphone" placeholder="手机号码"
                               required="required" value="$!respData.tel" name="tel" />
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">来源</label>
                    <div class="col-sm-6">
                        <select name="source" onchange="getUsers(this.value)" class="form-control" id="inputSource"
                                required readonly >
                            #if($respData)
                                <option value="0" #if($!respData.source == 0) selected #end>后台</option>
                                <option value="1" #if($!respData.source == 1) selected #end>信贷经理</option>
                            #else
                                <option value="0" #if($!respData.source == 0) selected #end>后台</option>
                            #end
                        </select>
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">状态:</label>
                    <div class="col-sm-6">
                        <select name="state" class="form-control" readonly >
                            #if($!respData)
                            <option value="0" #if($!respData.state == 0) selected #end>正常</option>
                            <option value="1" #if($!respData.state == 1) selected #end>购买</option>
                            <option value="2" #if($!respData.state == 2) selected #end>退款</option>
                            #else
                            <option value="0" selected >正常</option>
                            #end
                        </select>
                    </div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputUid" class="col-sm-2 col-form-label">来源用户</label>
                    <div class="col-sm-6">
                        <select name="uid" class="form-control" id="inputUid" readonly >
                            #if($respData)
                                <option value="$!respData.uid" >$!respData.sourceuname</option>
                            #else
                                <option value="$!muser.id" >$!muser.uname</option>
                            #end
                        </select>
                        <!--<input type="text" class="form-control" id="inputUid" value="$!respData.uid" name="uid"
                        required="required"/>-->
                    </div>
                    <div class="col-sm-2"></div>
                </div>

               <!-- 暂时无用
                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputType" class="col-sm-2 col-form-label">类型</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputType" value="$!respData.type" name="type"
                        required="required"/>
                    </div>
                    <div class="col-sm-2"></div>
                </div>-->

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputAge" class="col-sm-2 col-form-label">年龄</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputAge" value="$!respData.age" name="age"
                               required="required"/>
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">性别:</label>
                    <div class="col-sm-6">
                        <select name="sex" class="form-control" required>
                            <option value="1" #if($!respData.sex == 1) selected #end>男</option>
                            <option value="0" #if($!respData.sex == 0) selected #end>女</option>
                        </select>
                    </div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">城市名称</label>
                    <div class="col-sm-6">
                        省：<select id="province-selector" onchange="cityList(this.value)">
                            #foreach($prov in $provList)
                                <option value="$prov.code"  #if($prov.code == $respData.pcode) selected #end >$prov.name</option>
                            #end
                        </select>
                        市：
                        <select id="city-selector" name="citycode" onchange="setName()" required>
                            #foreach($city in $cityList)
                                <option value="$city.code" #if($city.code == $respData.citycode) selected #end>$city.name</option>
                            #end
                        </select>
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <input type="hidden" class="form-control" id="inputCity" value="$!respData.city" name="city" />

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputAddress" class="col-sm-2 col-form-label">地址</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputAddress" value="$!respData.address" name="address"
                        required="required"/>
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">贷款金额</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["16"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="loan_amount" id="inputLoan_amount$key.value"
                                   #if($respData.loan_amount == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputLoan_amount$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputLoan_period" class="col-sm-2 col-form-label">贷款时限（月）</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputLoan_period" value="$!respData.loan_period" name="loan_period"
                        required="required"/>
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">贷款用途</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["1"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="loan_use" id="inputLoan_use$key.value"
                                   #if($respData.loan_use == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputLoan_use$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">户籍</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["2"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="census" id="inputCensus$key.value"
                                   #if($respData.census == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputCensus$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">社保</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["6"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="social_security" id="inputSocial_security$key.value"
                                   #if($respData.social_security == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputSocial_security$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">公积金</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["6"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="provident_fund" id="inputProvident_fund$key.value"
                                   #if($respData.provident_fund == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputProvident_fund$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">职业</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["3"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="job" id="inputJob$key.value"
                                   #if($respData.job == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputJob$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">月收入</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["4"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="income" id="inputIncome$key.value"
                                   #if($respData.income == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputIncome$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">收入形式</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["5"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="incometype" id="inputIncometype$key.value"
                                   #if($respData.incometype == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputIncometype$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">信用卡</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["6"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="creditcard" id="inputCreditcard$key.value"
                                   #if($respData.creditcard == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputCreditcard$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">微粒贷</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["6"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="haswld" id="inputHaswld$key.value"
                                   #if($respData.haswld == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputHaswld$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">房产</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["13"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="hashouse" id="inputHashouse$key.value"
                                   #if($respData.hashouse == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputHashouse$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">车产</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["11"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="hascar" id="inputHascar$key.value"
                                   #if($respData.hascar == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputHascar$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">寿险保单</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["6"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="haslife" id="inputHaslife$key.value"
                                   #if($respData.haslife == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputHaslife$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>
               <!-- <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputHq" class="col-sm-2 col-form-label">是否优质单</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputHq" value="$!respData.hq" name="hq" />
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label for="inputDisount" class="col-sm-2 col-form-label">折扣</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="inputDisount" value="$!respData.disount" name="disount" />
                    </div>
                    <div class="col-sm-2"></div>
                </div>-->

                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">车辆抵押</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["12"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="carpawn" id="inputCarpawn$key.value"
                                   #if($respData.carpawn == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputCarpawn$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group row">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">房产抵押</label>
                    <div class="col-sm-6">
                        #foreach( $key in $tagInfo["12"] )
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="housepawn" id="inputHousepawn$key.value"
                                   #if($respData.housepawn == $key.value) checked #end  value="$key.value">
                            <label class="form-check-label" for="inputHousepawn$key.value">$key.name</label>
                        </div>
                        #end
                    </div>
                    <div class="col-sm-2"></div>
                </div>

                <div class="form-group row" id="errormsg">
                    <div class="col-sm-2"></div>
                    <label class="col-sm-2 col-form-label">错误信息</label>
                    <div class="col-sm-6" id="errorInfo">

                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group  row">
                    <div class="col-sm-4"></div>
                    <div class="col-sm-1"><a href="/orderpool/list" class="btn">取消</a></div>
                    <div class="col-sm-1"><button type="submit" class="btn btn-primary">#if($respData) 更新 #else 新建 #end</button></div>
                </div>

            </form>

        </div>
        #parse("/inc/copyright.htm")
    </div>
    <!-- /.content-wrapper -->
</div>
#parse("/inc/footer.htm")
<script>
    #if(!$respData)
        $("#province-selector").val("")
    #end

    if(! $("#city-selector").val()){
        $("#province-selector").val("")
    }

    function setName()
    {
        $("#inputCity").val($("#city-selector").find("option:selected").text())
    }

    function cityList(code){
        $("#city-selector").empty();
        $("#inputCity").val()
        $.ajax({
            url:"/system/cities?code="+code,
            method:"get",
            success:function (data) {
                if(data.state == "000"){
                    $("#inputCity").val(data.data[0].name)
                    for (var pos in data.data){
                        var domi = "<option value='"+data.data[pos].code+"'>"+data.data[pos].name+"</option>"
                        $("#city-selector").append(domi)
                    }
                }
            }
        })
    }
    ///orderpool/dataUpdate
    //$("form-pool-up").submit()
    $('.form_datetime').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 0,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        format: 'yyyy-mm-dd hh:ii:ss'
    });
</script>
</body>
</html>